package com.li.cn.excel;


import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import java.lang.reflect.Array;
import java.util.*;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: liujiang
 * @Date: 2021/01/09/23:20
 * @Description:
 */
public class Demo {
    public static void main(String[] args) {
       // int[] arr = {1,2,4,6,87,3,65,23,1,2,3,4,5,6};
//        int[] test = Demo.test2(arr);
//        System.out.println(Arrays.toString(test));
//        String s = "abcdefg";
//        String s1 = Demo.test3(s);
//        System.out.println(s1);
//        int i = Demo.test4(arr);
//        System.out.println(i);

//        List<String> list = new LinkedList<>();
//        boolean b1 = list instanceof ArrayList;
//        boolean b2 = list instanceof Collection;
//        System.out.println(b1 + "+" +b2);
        int a[] = new int[3];
        System.out.println(a[0]);
    }

    //选择排序
    public static int[] test(int[] arr){
        for (int i = 0; i < arr.length; i++) {
            for (int j = i+1; j < arr.length; j++) {
                if (arr[i] < arr[j]){
                    int temp = arr[i];
                    arr[i] = arr[j];
                    arr[j] = temp;
                }
            }
        }
        return arr;
    }

    //冒泡排序
    public static  int[] test2(int[] arr){
        for (int i = 0; i < arr.length-1; i ++){
            for (int j = 0; j < arr.length-i-1; j++) {
                if (arr[j] < arr[j+1]) {
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
        return arr;
    }

    //字符串反转
    public static String test3(String str){
//        String s1 ="";
//        for(int i = str.length()-1; i >= 0; i--){
//            char c = str.charAt(i);
//            s1 += c;
//        }
//        return s1;
        StringBuffer stringBuffer = new StringBuffer(str);
        String reverse = String.valueOf(stringBuffer.reverse());
        return reverse;
     }

    //找出不重复元素的个数
    public static int test4(int[] str){
        HashSet<Integer>  hs = new HashSet<Integer>();
        for (int i = 0; i < str.length; i++) {
            hs.add(str[i]);
        }
        return hs.size();
    }



}
